package com.qf.ssm.controller;

import com.qf.ssm.entity.Audit;
import com.qf.ssm.mapper.AuditMapper;
import com.qf.ssm.utils.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/audit")
public class AuditController {
    @Resource
    AuditMapper auditMapper;

    /**
     * 通过ID来更新  审核表
     */
    @PostMapping("/updateById")
    private ResponseResult<Integer>updateById(Audit record){
        return ResponseResult.success(auditMapper.updateByPrimaryKey(record));
    }
    /**
     * 数组形式批量删除
     */
    @PostMapping("/updateList")
    private ResponseResult<Integer>updateList(int[]ids){
        return ResponseResult.success(auditMapper.updateList(ids));
    }
    /**
     * 集合批量删除
     *
     */
    @PostMapping("/updateListAa")
    private ResponseResult<Integer>updateListAa(@RequestBody List<Integer> ids){
        return ResponseResult.success(auditMapper.updateListGather(ids));

    }
    /**
     * 批量增加
     */
    @PostMapping("/insertList")
    private ResponseResult<Integer>insertList(@RequestBody List<Audit> audits){
        return ResponseResult.success(auditMapper.insertList(audits));
    }
}
